<template>
	<div>
		<div class="bg"></div>
		<div class="header header_bg">

			<div class="header_left">
				<i onclick="javascript:history.back(-1)" class="iconfont baiColor">&#xe612;</i>
			</div>
			<div class="header_center">
				<span class="baiColor" >昵称</span>
			</div>
		</div>

		<div class="center" style="padding-top: 47px;">
			<form action="">
				<input type="text" v-model="name" placeholder="输入你要修改的昵称" />
				<!--<router-link :to="{name:'info'}">-->
					<button class="baocun" @click="saveName($event)">保存</button>
				<!--</router-link>-->
			</form>
		</div>
	</div>

</template>

<script>
	export default {
		data() {
			return {
				name: ''
			}
		},
		
		methods: {
			//成功
			saveName: function(ev) {
				ev.preventDefault();
				var params = new URLSearchParams();
				var info = window.localStorage.data;
				params.append('token', info); //客户秘钥（信息）
				params.append('data', this.name);//用户名
				params.append('type', 2);
	          	this.$axios({
					url: "One/My/myCenter",
					method: "POST",
					data: params
				}).then((res) => {
					if(res.data.status == 2){
						alert('请重新输入')
					}else{
						this.$router.push({name:'info'})
					}
				}).catch(function(err) {
					console.log(err)
				})
			}
		}
	}
</script>

<style scoped="scoped">
	@import "../css/public.css";
	.bg {
		position: fixed;
		width: 100%;
		height: 100%;
		z-index: -100;
		background: #f0f0f0;
	}
	
	.center {
		width: 95%;
		margin: 0px auto;
	}
	
	.center input {
		margin-top: 5px;
		width: 100%;
		border: none;
		/*border: solid 1px #FCFCFC ;*/
		background: #FCFCFC;
		height: 45px;
		font-size: 15px;
		padding-left: 14px;
	}
	
	.center button {
		background: #F3961F;
		width: 100%;
		height: 45px;
		border-radius: 10px;
		font-size: 18px;
		color: #FCFCFC;
		margin-top: 16px;
	}
</style>